package com.sl.ms.sms;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.beans.factory.annotation.Value;

/**
 * @author 姜星宇
 * @date 2024/9/7 11:06
 */

public class Smsple {
//    @Value("${albaba.accessKeyId}")
//    private String accessKeyId;
//    @Value("${albaba.accessKeySecret}")
//    private String accessKeySecret;
    public static void main(String[] args) {
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou","LTAI5tPVQmHZrvSNMRWQGu3y","mH3Is3iSHVGufy3p94FQEwo7JCgweZ");
        IAcsClient client = new DefaultAcsClient(profile);
        CommonRequest request = new CommonRequest();
        request.setSysMethod(MethodType.POST);
        request.setSysDomain("dysmsapi.aliyuncs.com");
        request.setSysVersion("2017-05-25");
        request.setSysAction("SendSms");
        request.putQueryParameter("PhoneNumbers","15737955382");
        request.putQueryParameter("SignName","影子代理网络技术公司");
        request.putQueryParameter("TemplateCode","SMS_472730058");
        request.putQueryParameter("TemplateParam","{\"code\":\"2580\"}");
        try {
            CommonResponse response =client.getCommonResponse(request);
            System.out.println(response.getData());
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
